home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume7 / nag / part01 next >
Encoding:
Internet Message Format  |  1986-11-30  |  7.1 KB

  1. Subject:  v07i062:  Nag reminder service, Part01/02
  2. Newsgroups: mod.sources
  3. Approved: mirror!rs
  4.  
  5. Submitted by: daveb@rtech.uucp (Dave Brower)
  6. Mod.sources: Volume 7, Issue 62
  7. Archive-name: nag/Part01
  8.  
  9. This is a program I use to warn me about upcoming meetings and other
  10. events I need to be forcefully provoked to attend.  It has been used on
  11. CCI Power6-BSD, CCI-Power 6-SV and the AT&T Unix-PC.
  12.  
  13. [  The comparison with other programs, given in the README, is interesting.
  14.    --r$  ]
  15.  
  16. #!/bin/sh
  17. # This is a shell archive, meaning:
  18. # 1. Remove everything above the #!/bin/sh line.
  19. # 2. Save the resulting text in a file.
  20. # 3. Execute the file with /bin/sh (not csh) to create the files:
  21. #    README
  22. #    nag.1
  23. #    Makefile
  24. # This archive created: Fri Sep 12 16:16:27 1986
  25. export PATH; PATH=/bin:$PATH
  26. echo shar: extracting "'README'" '(1410 characters)'
  27. if test -f 'README'
  28. then
  29.     echo shar: over-writing existing file "'README'"
  30. fi
  31. sed 's/^X//' << \SHAR_EOF > 'README'
  32. XDescription
  33. X-----------
  34. X
  35. XNag and okok are provide a reminder service for people who need
  36. Xa *lot* of provocation before doing something.
  37. X
  38. XThe system lets you run arbitrary commands at intervals around
  39. Xspecified events.  For instance, you can echo a message 15, 10,
  40. Xand 5 minutes before a meeting.  The configuration is kept in a
  41. X~/.nag file.  You add and alter events with your favorite
  42. Xeditor.
  43. X
  44. XOkok (which is just a link to nag) provides a simple way of
  45. Xshutting up messages once you've gotten the point.
  46. X
  47. XYou start a nag daemon in your .login or .profile.  It puts
  48. Xitself in the background and exits after you log off.
  49. X
  50. XThe system works correctly if you are logged into multiple
  51. Xterminals. Each login gets it's own daemon issuing messages on
  52. Xeach terminal. Running okok on one will silence output on all
  53. Xthe others.
  54. X
  55. XComparisons with existing facilities
  56. X------------------------------------
  57. X
  58. Xat:
  59. X    * Makes you post the events.
  60. X    * No intervals
  61. X    * Not available to all users.  Even on SV.2 with user cron tables,
  62. X      you need special permission in cron.allow.
  63. X    * Doesn't know when you log out.
  64. X
  65. Xcron:
  66. X    * No intervals.
  67. X    * Not available to all users.  Even on SV.2 with user cron tables,
  68. X      you need special permission in cron.allow.
  69. X    * Doesn't know when you log out.
  70. X    * Hard to turn off.
  71. X
  72. Xcalendar:
  73. X    * One mail message only (too easy to ignore).
  74. X    * No subject line in the mail.
  75. X
  76. Xleave:
  77. X    * Inadequate flexibility.
  78. SHAR_EOF
  79. if test 1410 -ne "`wc -c 'README'`"
  80. then
  81.     echo shar: error transmitting "'README'" '(should have been 1410 characters)'
  82. fi
  83. echo shar: extracting "'nag.1'" '(3319 characters)'
  84. if test -f 'nag.1'
  85. then
  86.     echo shar: over-writing existing file "'nag.1'"
  87. fi
  88. sed 's/^X//' << \SHAR_EOF > 'nag.1'
  89. X.TH NAG 1 "Thu Sep  4 11:48:01 PDT 1986"
  90. X.SH NAME
  91. Xnag \- annoying reminder service daemon.
  92. X.SH SYNOPSIS
  93. X.B nag
  94. X.br
  95. X.B okok
  96. X.SH DESCRIPTION
  97. X.I Nag
  98. Xissues reminders from your ~/.nag file as specified.  You start
  99. X.I nag
  100. Xin your
  101. X.I .profile
  102. Xor
  103. X.I .login,
  104. Xwhere it lies around much like
  105. X.I leave(1)
  106. Xuntil you logout.  It reads the .nag file, and executes reminder
  107. Xcommands at intervals before a time.  Reminders are silenced with
  108. X.I okok.
  109. XWhen you log off,
  110. X.I nag
  111. Xexits just before it would have executed a command on your behalf.
  112. X.PP
  113. X.I Nag
  114. Xignores interrupts, quits and terminates.  To get rid of it, you can log
  115. Xoff or use ``kill \-9.''
  116. X.PP
  117. XThe .nag file has the format:
  118. X.nf
  119. X
  120. X    [ status ] day time interval command
  121. X.fi
  122. X.PP
  123. X.I status
  124. Xis either
  125. X.br
  126. X(1) '#', marking a comment line
  127. X.br
  128. X(2) ':', turning off execution of commands for the event.
  129. X.PP
  130. X.I day
  131. Xis one of
  132. X.br
  133. X(1) A date such as mm/dd/yy, or reasonable alternatives.
  134. X.br
  135. X(2) `*' meaning every day.
  136. X.br
  137. X(3) A day of the week.
  138. XDay names may be recognizably abbreviated.
  139. X.PP
  140. X.I time
  141. Xis a standard time specification, like ``12:05'' or ``3AM''
  142. X.PP
  143. X.I interval
  144. Xis a colon separated list of signed integer offsets from the
  145. Xevent
  146. X.I time
  147. Xthe
  148. X.I command
  149. Xwill be executed.  Negative values are before the event, 0 at the event,
  150. Xand positive values later.
  151. X.PP
  152. X.I command
  153. Xis a string up to a newline that will be executed by
  154. X.I system(3)
  155. Xon your behalf at the specified
  156. X.I interval
  157. Xuntil you shut it up with
  158. X.I okok.
  159. X.PP
  160. XSome shell variables are set for use by the command:
  161. X.br
  162. X.B pretime
  163. Xis set to the -interval.
  164. X.br
  165. X.B posttime
  166. Xis set to the interval.
  167. X.br
  168. X.B now
  169. Xis set to an hh:mm string of the present time, in 24 hour format.
  170. X.br
  171. X.B then
  172. Xis set to an hh:mm string of the event time.
  173. X.PP
  174. X.I okok
  175. Xshuts up the the nagging.  It opens the terminal and prompts with the
  176. Xcommand(s) nearing their times, like rm -i.  Answering `y' silences
  177. Xfurther executions of the command.  It does this by editing the .nag
  178. Xfile, which is noticed by any running
  179. X.I nag
  180. Xprocesses the next time they wake up.
  181. X.PP
  182. XWhen a silenced event is past it's last possible occurrance,
  183. X.I nag
  184. Xre\-enables it by writing the .nag file.  This makes `*' reminders
  185. Xwork the next day.
  186. X
  187. X.SH EXAMPLES
  188. XA .nag file might have the following entries:
  189. X.PP
  190. X.br
  191. X 8/8/88 2PM -60:-30:-15:0 writebig "$pretime to Client call at $then"
  192. X.br
  193. X Mon 3PM -60:-30:-15:0 hey "Status report due in $pretime minutes"
  194. X.br
  195. X Wed 3:30PM -30:-15:-5:0 echo "Committee at $then in $pretime minutes"
  196. X.br
  197. X * 13:00 -45:-30:0 writebig "Lunch in $pretime minutes"
  198. X.br
  199. X * 7PM -5:-4:-3:-2:-1:0 echo "GO HOME!!! It's $now"
  200. X.br
  201. X * 10:30 -10:-5:0 echo "Donut truck in $pretime minutes"
  202. X.SH FILES
  203. X.ta 2i
  204. X.B ~/.nag    file describing things to do.
  205. X.SH ENVIRONMENT
  206. X.br
  207. X.B NAGFILE    a file to use as the nagfile instead of ~/.nag
  208. X.SH "SEE ALSO"
  209. Xat(1),
  210. Xcalendar(1),
  211. Xhey(1),
  212. Xleave(1),
  213. Xsleep(1),
  214. Xcron(8)
  215. X.SH DIAGNOSTICS
  216. XComplains about various syntax errors and times out of range, and problems
  217. Xaccessing .nag file
  218. X.SH BUGS
  219. X.PP
  220. XProbably won't work with `stty nostop' set.
  221. X.PP
  222. XIntervals will be approximate because of sleep granularity and scheduling
  223. Xcontention.
  224. X.PP
  225. XThere is no locking of the .nag file.  This could be trouble if a
  226. X.I nag
  227. Xand an
  228. X.I okok
  229. Xdecide to write at the same time.
  230. X.SH AUTHOR
  231. XDavid Brower
  232. X.br
  233. X{sun, cbosgd, amdahl, mtxinu}!rtech!gonzo!daveb
  234. X
  235. X
  236. SHAR_EOF
  237. if test 3319 -ne "`wc -c 'nag.1'`"
  238. then
  239.     echo shar: error transmitting "'nag.1'" '(should have been 3319 characters)'
  240. fi
  241. echo shar: extracting "'Makefile'" '(619 characters)'
  242. if test -f 'Makefile'
  243. then
  244.     echo shar: over-writing existing file "'Makefile'"
  245. fi
  246. sed 's/^X//' << \SHAR_EOF > 'Makefile'
  247. X#
  248. X# Makefile for the nag/okok system.
  249. X#
  250. X
  251. XSHAR1 =        README nag.1 Makefile 
  252. XSHAR2 =        $(SRCS)
  253. X
  254. X# -DSYS5 for System V, nothing for BSD.
  255. XDEFS =        # -DSYS5
  256. XOPTDEB =    -O
  257. XCFLAGS =    $(DEFS) $(OPTDEB)
  258. XOBJS =        gdate.o nag.o
  259. XSRCS =        gdate.c nag.c
  260. X
  261. Xall:        nag okok
  262. X
  263. Xclean:;        rm -f $(OBJS) nag okok gdate OUT LINT a.out core
  264. X
  265. Xnag:        $(OBJS)
  266. X        cc -g -o nag $(OBJS)
  267. X
  268. Xokok:        nag
  269. X        ln nag okok
  270. X
  271. Xgdate:        gdate.c
  272. X        cc -DDEBUG $(CFLAGS) gdate.c -o gdate
  273. X
  274. Xlint:        LINT
  275. X
  276. XLINT:        $(SRCS)
  277. X        lint $(DEFS) $(SRCS) > LINT
  278. X
  279. Xshar:        nag1.shar nag2.shar
  280. X
  281. Xnag1.shar:    $(SHAR1)
  282. X        shar -a $(SHAR1) > nag1.shar
  283. X
  284. Xnag2.shar:    $(SHAR2)
  285. X        shar -a $(SHAR2) > nag2.shar
  286. X
  287. SHAR_EOF
  288. if test 619 -ne "`wc -c 'Makefile'`"
  289. then
  290.     echo shar: error transmitting "'Makefile'" '(should have been 619 characters)'
  291. fi
  292. #    End of shell archive
  293. exit 0
  294.  
  295.  
  296.  
  297.  
  298.  
  299.